package com.t11;

import net.mindview.util.Stack;

/**
 * Created by xuyiwei on 2018/7/22.
 */
public class E15 {
    public static void showStack(String s){
        Stack<Character> stack = new Stack<Character>();
        char[] cs =s.toCharArray();
        for(int i =0;i<cs.length;){
            switch (cs[i++]){
                case '+' : stack.push(cs[i]);
                break;
                case '-':
                    System.out.print(stack.pop());
            }
        }
    }

    public static void main(String[] args) {
        showStack("+U+n+c---+e+r+t---+a-+i-+n+t+y---+ -+r+u--+l+e+s---");
    }
    //+U+n+c---+e+r+t---+a-+i-+n+t+y---+ -+r+u--+l+e+s---
}
